﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using LinkCard.Utils;

namespace LinkCard.CustomerView.Controls
{
    public partial class Category : System.Web.UI.UserControl
    {
        public int nCategoryID;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack) {
                nCategoryID = ConvertUtility.ToInt32(Page.RouteData.Values["pcid"]);
                
                DataTable dt = DataHelper.SelectTable("Select CategoryID, Name from Category where ParentID = 0 and IsDisplay = 1 order by Position, Name  ", false);
                if (dt.Rows.Count > 0)
                {
                    if (nCategoryID == 0) nCategoryID = ConvertUtility.ToInt32(dt.Rows[0]["CategoryID"]);
                    categoryList.DataSource = dt;
                    categoryList.DataBind();
                }
            }
        }
    }
}